<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<html:xhtml />
<script type="text/javascript">
    $(document).ready(function() {
        // 'DataTablize' the table
        $("#geneTable").dataTable({
            "bPaginate": true,
            "sPaginationType": "full_numbers",
            "bFilter": true,
            "bJQueryUI": true,
            "bAutoWidth": false
        });
    });

   function snpGeneExcel(){
        // Set up snp select dialog
        $("#snpGeneExcel").dialog({
            width: 400,
            autoOpen: true,
            modal: true
        });
    }
</script>
<div id="makePathwayGeneList" class="content list">
    <h2>Pathway to Gene Results Table</h2>
    <table id="geneTable" cellpadding="0" cellspacing="0" border="0" class="display">
        <thead>
            <tr>
                <th>Pathway Name</th>
                <th>NCBI Gene ID</th>
                <th>Gene Name</th>
            </tr>
        </thead>
        <tbody>
            <logic:iterate id="pathGene" name="snpGeneForm" property="pathGeneHash">
                <logic:iterate id="geneList" name="pathGene" property="value">
                <tr>
                    <td><bean:write name="pathGene" property="key" /></td>
                    <td><bean:write name="geneList" property="entrezGeneID"/></td>
                    <td><bean:write name="geneList" property="name"/></td>
                </tr>
                </logic:iterate>
            </logic:iterate>
        </tbody>
    </table>
    <html:link href="#" onclick="snpGeneExcel()">Export Results to File</html:link>
    <p></p>
</div>

<div id="snpGeneExcel" class="content input" style="display:none">
    <html:form action="pathwayGeneExport" enctype="multipart/form-data">
        <dl>
            <dt>Filename:</dt>
            <dd><html:text property="filename"/></dd>
            <dt>Delimiter</dt>
            <dd><html:select property="dlimiter">
                    <html:option value="tab">Tab Delimited</html:option>
                    <html:option value="csv">Comma Separated</html:option>
                </html:select></dd>
            </dl>
            <html:submit value="Download" property="submitType" onclick="$('#snpGeneExcel').dialog('close');"/>
            <html:button property="" value="Cancel" onclick="$('#snpGeneExcel').dialog('close');"/>
    </html:form>
</div>